//
//  GYMineProductInfoEditDetailCell.m
//  GYDemo
//
//  Created by mac on 2018/3/30.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "GYMineProductInfoEditDetailCell.h"
#import "Head.h"

@interface GYMineProductInfoEditDetailCell()
@end

@implementation GYMineProductInfoEditDetailCell
#pragma mark - getter and setter
-(UIImageView *)imageIV
{
    if (!_imageIV) {
        _imageIV = [UIImageView new];
       // _imageIV.backgroundColor = Main_Color_BG;
        
    }
    return _imageIV;
}
-(GYMineProductImageView *)imagesV
{
    if (!_imagesV) {
        _imagesV = [GYMineProductImageView new];
    }
    return _imagesV;
}
-(void)setSpecialType:(NSInteger)specialType
{
    _specialType = specialType;
    [self layoutSubviews];
}
#pragma mark - life
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.imageIV];
        [self.contentView addSubview:self.imagesV];
        _specialType = 0;
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    _imageIV.width = self.contentView.height - WFCGFloatY(10);
    _imageIV.height = _imageIV.width;
    
    if (_specialType == 1) {
        self.textView.hidden = YES;
        _imageIV.x = WFCGFloatX(13);
        _imageIV.y = WFCGFloatY(5);
        _imageIV.width = self.contentView.height - WFCGFloatY(10);
        _imageIV.height = _imageIV.width;
        if (self.titleLB.text.length > 0) {
            self.titleLB.hidden = NO;
            _imageIV.x = WF_UI_VIEW_WIDTH - WFCGFloatX(13) - _imageIV.width;
        }else{
            self.titleLB.hidden = YES;
        }
        self.imageIV.hidden = NO;
        self.imagesV.hidden = YES;
        
    }else if (_specialType == 2) {
        self.titleLB.hidden = YES;
        self.textView.hidden = YES;
        self.imageIV.hidden = YES;
        self.imagesV.hidden = NO;
        _imagesV.frame = CGRectMake(0, 0, self.contentView.width, self.contentView.height);
    }else{
        self.textView.hidden = NO;
        self.titleLB.hidden = NO;
        self.imageIV.hidden = YES;
        self.imagesV.hidden = YES;
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
